<form id="ticketForm" name="ticketForm" action="" method="post">

    <div id="search">
        <label>Ticket Number:&nbsp;</label>
        <input type="textbox" id="input_ticketno" name="data[status][ticketno]" />
        <div id="spacer"></div>
        <div id="spacer"></div>
        <div id="spacer"></div>
        <div id="spacer"></div>
        <input type="button" id="button_submit" value="Check" class="button" />
    </div>

    <div id="result" style="visibility: <?php echo $visibility; ?>;">
        <div id="spacer"></div>
        <div id="spacer"></div>
        <div id="spacer"></div>
        <div id="spacer"></div>
        <div id="spacer"></div>

        <h2>Ticket Updates: <?php echo $ticket_code; ?></h2>
        <div id="breakline"></div>
        <div id="spacer"></div>
        <div id="accordion">
            <?php
             if ($status) {
                foreach ($status['remarks'] as $v) {
             ?>
            <h3><a href="#"><?php echo date('M d, Y', strtotime($v['TicketDetail']['date_taken_action']))?></a></h3>
            <div>
                <p align="left">
                    <label>Action</label>
                    <p align="left"><?php echo $v['TicketDetail']['action_taken']; ?></p>
                </p>
                <p align="left">
                  <label>Recommendation</label>
                  <p align="left"><?php echo $v['TicketDetail']['recommendation']?></p>
                </p>
            </div>
            <?php
                }
             }
            ?>
        </div>

    </div>

</form>

<script type="text/javascript">
    $(document).ready(function(){

        $("#button_submit").click(function() {
            if ($("#input_ticketno").val() != "") {
                $("#ticketForm").attr("action", "<?php echo $html->url('/ticket/checkstatus'); ?>");
                $("#ticketForm").submit();

                var result = "<?php echo count($status['remarks']); ?>";
                if (result == 0) {
                    alert('No updates with specified ticket');
                }
            } else {
                alert('Please provide ticket no to be check');
                $("#input_ticketno").focus();
            }
        });

		$("#accordion").accordion({
			icons: {
    			header: "ui-icon-circle-arrow-e",
   				headerSelected: "ui-icon-circle-arrow-s"
			}
        });
       
    });
</script>